package xyz.lne.researchgroupmanage.entity.neo4j;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;
import org.springframework.beans.BeanUtils;
import xyz.lne.researchgroupmanage.entity.ResearchGroup;

/**
 * Designed By Lne.
 * 2021/3/2 16:54
 */
@NodeEntity(label = "researchGroup")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResearchGroupNode {
    @Id
    @GeneratedValue
    private Long id;
    @Property(name = "name")
    private String name;
    @Property(name = "researchgroupId")
    private Integer researchgroupId;

    public static ResearchGroupNode convertFromResearchGroup(ResearchGroup researchGroup){
        ResearchGroupNode researchGroupNode = new ResearchGroupNode();
        BeanUtils.copyProperties(researchGroup, researchGroupNode);
        return researchGroupNode;
    }
}
